package mall

import (
	"github.com/gin-gonic/gin"
	v1 "main.go/api/v1"
	"main.go/middleware"
)

type UserRouter struct{}

func (r *UserRouter) InitUserRouter(Router *gin.RouterGroup) {
	group := Router.Group("user")
	privateAdminGroup := Router.Group("admin/user").Use(middleware.Auth("admin"))
	privateGroup := Router.Group("user").Use(middleware.Auth("app"))

	api := v1.ApiGroupApp.MallApiGroup.UserApi
	{
		privateAdminGroup.POST("create", api.Create) // 增
		privateAdminGroup.POST("delete", api.Delete) // 删
		privateAdminGroup.POST("update", api.Update) // 改
		privateAdminGroup.POST("list", api.List)     // 查
	}
	{
		privateGroup.GET("userInfo", api.UserInfo) // 查
	}
	{
		group.POST("login", api.Login)
	}
}
